/**
 * @file record.h
 * @copyright Copyright (C) 2015-2018 Alibaba Group Holding Limited
 */

#ifndef CX_FACERECOG_H
#define CX_FACERECOG_H

#include <stddef.h>
#include <stdint.h>
#include "cx_common.h"

#ifdef __cplusplus
extern "C" {
#endif

#define CX_FR_MAX_USRNAME_LEN       32

typedef struct {
    char *info_save_path;           // user info save path
    void *alg_spec;
} cx_fr_config_t;

typedef struct {
    char user_name[CX_FR_MAX_USRNAME_LEN];
    int is_admin;                   // user is admin
} cx_fr_user_info_t;

typedef enum {
    CX_USER_DEL_SINGLE = 0,
    CX_USER_DEL_ALL
} cx_fr_user_type_e;

typedef struct {
} cx_fr_state_t;

typedef struct {
    int success;
    int user_id;
    // char user_name[32];
} cx_fr_register_result_t;

typedef enum {
	CX_VERIFY_RESULT_SUCCESS = 0,
	CX_VERIFY_RESULT_NO_FACE,
	CX_VERIFY_RESULT_FACE_MORE,
	CX_VERIFY_RESULT_BAD_POSTURE,
	CX_VERIFY_RESULT_FUZZY,
	CX_VERIFY_RESULT_COVER,
	CX_VERIFY_RESULT_LIVING_NIR_FAILED,
	CX_VERIFY_RESULT_LIVING_3D_FAILED,
	CX_VERIFY_RESULT_NOT_MATCH,
	CX_VERIFY_RESULT_REPEAT,
} cx_verify_result_e;
typedef struct {
    cx_verify_result_e result;
    int user_id;
} cx_fr_verify_result_t;

int cx_facerecog_init(
    cx_fr_config_t *settings,
    void (* user_state_cb)(cx_fr_state_t *state),
    void (* user_register_cb)(cx_fr_register_result_t *result),
    void (* user_verify_cb)(cx_fr_verify_result_t *result)
);

int cx_facerecog_deinit(void);

int cx_facerecog_user_enroll(int face_dir, int timeout_s);

int cx_facerecog_add_user_info(int user_id, cx_fr_user_info_t *info);

int cx_facerecog_get_user_info(int user_id, cx_fr_user_info_t *info);

int cx_facerecog_get_all_user_id(int max_user_count, int user_id[]);

int cx_facerecog_user_verify(int timeout);

int cx_facerecog_user_delete(cx_fr_user_type_e type, int user_id);


/** @} */

#ifdef __cplusplus
}
#endif

#endif /* CX_FACERECOG_H */

